



#ifndef _PDF_FONT_DETAILS_H_
#define _PDF_FONT_DETAILS_H_


#include "wx/pdfdocdef.h"
#include "wx/pdfarraytypes.h"
#include "wx/pdffontdata.h"
#include "wx/pdffontextended.h"

class WXDLLIMPEXP_FWD_PDFDOC wxPdfFont;

/// Class representing the font manager
class wxPdfFontDetails
{
public:
  /// Constructor
  
  wxPdfFontDetails(int index, const wxPdfFont& font);

  /// Default destructor
  ~wxPdfFontDetails();

  /// Copy destructor
  wxPdfFontDetails(const wxPdfFontDetails&);

  /// Assignment operator
  wxPdfFontDetails& operator=(const wxPdfFontDetails&);
  
  /// Set font index
  
  void SetIndex(int index) { m_index = index; }

  /// Get font index
  
  int  GetIndex() const { return m_index; }

  /// Set font object index
  
  void SetObjIndex(int n) { m_n = n; }

  /// Get font object index
  
  int  GetObjIndex() const { return m_n; }

  /// Set font file index
  
  void SetFileIndex(int fn) { m_fn = fn; }

  /// Get font file index
  
  int  GetFileIndex() const { return m_fn; }

  /// Set encoding differences index
  
  void SetDiffIndex(int ndiff) { m_ndiff = ndiff; }

  /// Get encoding differences index
  
  int  GetDiffIndex() const { return m_ndiff; }

  /// Get font type
  
  wxString GetType() const;

  /// Get font name
  
  wxString GetName() const;

  /// Get original font name
  
  wxString GetOriginalName() const;

  /// Get font family
  
  wxString GetFontFamily() const;

  /// Get the font description
  
  const wxPdfFontDescription& GetDescription() const;

  /// Check whether the font has differences to WinAnsi encoding
  
  bool HasDiffs() const;

  /// Get encoding differences
  
  wxString GetDiffs() const;

  /// Get the name of the base encoding of the font
  
  wxString GetBaseEncoding() const;

  /// Get the font as an extended font object
  
  wxPdfFontExtended GetFont() const;

  /// Get the font as a user font object
  
  wxPdfFont GetUserFont() const;

  /// Create a name prefix for a subset
  
  wxString CreateSubsetPrefix() const;

  /// Get the width of a string
  
  double GetStringWidth(const wxString& s, bool withKerning = false);

  /// Get kerning width array
  
  wxArrayInt GetKerningWidthArray(const wxString& s) const;

  /// Convert character codes to glyph numbers
  
  wxString ConvertCID2GID(const wxString& s);

  /// Convert glyph number to string
  
  wxString ConvertGlyph(wxUint32 glyph);

  /// Get the character width array as string
  
  wxString GetWidthsAsString() const;

  /// Write font data 
  
  size_t WriteFontData(wxOutputStream* fontData);

  /// Write character/glyph to unicode mapping
  
  size_t WriteUnicodeMap(wxOutputStream* mapData);

#if wxUSE_UNICODE
  /// Get the associated encoding converter
  
  wxMBConv* GetEncodingConv() const;
#endif

protected:
  int                  m_index; ///< Index number of this font
  int                  m_n;     ///< Font object index
  int                  m_fn;    ///< Font file index
  int                  m_ndiff; 
  wxPdfFontExtended    m_font;         ///< Extended font for accessing font data
  wxPdfSortedArrayInt* m_usedGlyphs;   ///< Array of used characters
  wxPdfChar2GlyphMap*  m_subsetGlyphs; 
private:
  /// Default constructor not available
  wxPdfFontDetails();
};

#endif
